package com.quicks.beauty.server.common;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.deser.std.DateDeserializers.DateDeserializer;

import java.util.Date;

/**
 * @borball on 5/15/2016.
 */
public class OrderQueryResponse {

	@JsonProperty("appid")
	private String appid;

	@JsonProperty("mch_id")
	private String mch_id;

	@JsonProperty("nonce_str")
	private String nonce_str;

	@JsonProperty("sign")
	private String sign;

	@JsonProperty("device_info")
	private String device_info;

	@JsonProperty("openid")
	private String openid;

	private boolean subscribed;

	@JsonProperty("trade_type")
	private String trade_type;

	@JsonProperty("trade_state")
	private String trade_state;

	@JsonProperty("bank_type")
	private String bank_type;

	@JsonProperty("total_fee")
	private int total_fee;

	@JsonProperty("settlement_total_fee")
	private int settlement_total_fee;

	@JsonProperty("fee_type")
	private String fee_type;

	@JsonProperty("cash_fee")
	private int cash_fee;

	@JsonProperty("cash_fee_type")
	private String cash_fee_type;

	@JsonProperty("coupon_fee")
	private int coupon_fee;

	@JsonProperty("coupon_count")
	private int coupon_count;

	@JsonProperty("transaction_id")
	private String transaction_id;

	@JsonProperty("out_trade_no")
	private String out_trade_no;

	private String attach;

	@JsonProperty("time_end")
	@JsonDeserialize(using = DateDeserializer.class)
	private Date time_end;

	@JsonProperty("trade_state_desc")
	private String trade_state_desc;

	@JsonProperty("return_code")
	private String return_code;

	@JsonProperty("return_msg")
	private String return_msg;

	@JsonProperty("result_code")
	private String result_code;

	@JsonProperty("err_code")
	private String err_code;

	@JsonProperty("err_code_des")
	private String err_code_des;

	public boolean success() {
		return "SUCCESS".equals(return_code) && "SUCCESS".equals(result_code);
	}

	public boolean isSubscribed() {
		return this.subscribed;
	}

	public void setSubscribed(String subscribed) {
		this.subscribed = "Y".equalsIgnoreCase(subscribed);
	}

	public String getAttach() {
		return attach;
	}

	public void setAttach(String attach) {
		this.attach = attach;
	}

	public String getDevice_info() {
		return device_info;
	}

	public void setDevice_info(String device_info) {
		this.device_info = device_info;
	}

	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public String getTrade_type() {
		return trade_type;
	}

	public void setTrade_type(String trade_type) {
		this.trade_type = trade_type;
	}

	public String getTrade_state() {
		return trade_state;
	}

	public void setTrade_state(String trade_state) {
		this.trade_state = trade_state;
	}

	public String getBank_type() {
		return bank_type;
	}

	public void setBank_type(String bank_type) {
		this.bank_type = bank_type;
	}

	public int getTotal_fee() {
		return total_fee;
	}

	public void setTotal_fee(int total_fee) {
		this.total_fee = total_fee;
	}

	public int getSettlement_total_fee() {
		return settlement_total_fee;
	}

	public void setSettlement_total_fee(int settlement_total_fee) {
		this.settlement_total_fee = settlement_total_fee;
	}

	public String getFee_type() {
		return fee_type;
	}

	public void setFee_type(String fee_type) {
		this.fee_type = fee_type;
	}

	public int getCash_fee() {
		return cash_fee;
	}

	public void setCash_fee(int cash_fee) {
		this.cash_fee = cash_fee;
	}

	public String getCash_fee_type() {
		return cash_fee_type;
	}

	public void setCash_fee_type(String cash_fee_type) {
		this.cash_fee_type = cash_fee_type;
	}

	public int getCoupon_fee() {
		return coupon_fee;
	}

	public void setCoupon_fee(int coupon_fee) {
		this.coupon_fee = coupon_fee;
	}

	public int getCoupon_count() {
		return coupon_count;
	}

	public void setCoupon_count(int coupon_count) {
		this.coupon_count = coupon_count;
	}

	public String getTransaction_id() {
		return transaction_id;
	}

	public void setTransaction_id(String transaction_id) {
		this.transaction_id = transaction_id;
	}

	public String getOut_trade_no() {
		return out_trade_no;
	}

	public void setOut_trade_no(String out_trade_no) {
		this.out_trade_no = out_trade_no;
	}

	public Date getTime_end() {
		return time_end;
	}

	public void setTime_end(Date time_end) {
		this.time_end = time_end;
	}

	public String getTrade_state_desc() {
		return trade_state_desc;
	}

	public void setTrade_state_desc(String trade_state_desc) {
		this.trade_state_desc = trade_state_desc;
	}

	public String getReturn_code() {
		return return_code;
	}

	public void setReturn_code(String return_code) {
		this.return_code = return_code;
	}

	public String getReturn_msg() {
		return return_msg;
	}

	public void setReturn_msg(String return_msg) {
		this.return_msg = return_msg;
	}

	public String getResult_code() {
		return result_code;
	}

	public void setResult_code(String result_code) {
		this.result_code = result_code;
	}

	public String getErr_code() {
		return err_code;
	}

	public void setErr_code(String err_code) {
		this.err_code = err_code;
	}

	public String getErr_code_des() {
		return err_code_des;
	}

	public void setErr_code_des(String err_code_des) {
		this.err_code_des = err_code_des;
	}

	public void setSubscribed(boolean subscribed) {
		this.subscribed = subscribed;
	}

}
